import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path';
import pxtovw from 'postcss-px-to-viewport';
const loder_pxtovw = pxtovw({
  //这里是设计稿宽度 自己修改
  viewportWidth: 1920,
  viewportUnit: 'vw'
})
export default defineConfig({
  plugins: [react(),],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, './src'),//配置@别名
      "@style": path.resolve(__dirname, './src/assets/styles'),//配置@别名
      "@images": path.resolve(__dirname, './src/assets/images')//配置@别名
    }
  },
  server: {
    host: "localhost",
    open: true,
    port: 3000,
    hmr:true,
  },
  css: {
    postcss: {
      plugins: [loder_pxtovw]
    },
  },
})


